
store.registerModule('costsController', {
  namespaced: true,
  state: {
    // ${description}
    ${className?uncap_first}: {
        datas: [],
        outputPage: {},
    },
  },

  mutations: {
    // ${description}
    GET_${className?upper_case}(state, data) {
      state.${className?uncap_first}.datas = data.datas
      state.${className?uncap_first}.outputPage = Object.assign({}, data.outputPage)
    },
    UPDATE_${className?upper_case}(state, { data }) {
      const datas = state.${className?uncap_first}.datas
      const node = datas.find(item => item.id == data.id)
      if (node) {
        Object.assign(node, data)
      } else {
        datas.unshift(data)
        state.${className?uncap_first}.outputPage.totalResult++
      }
    },
    DEL_${className?upper_case}(state, data) {
      state.${className?uncap_first}.datas = state.${className?uncap_first}.datas.filter((item) => (item.id !== data.id))
      state.${className?uncap_first}.outputPage.totalResult--
    },
  },

  actions: {
    // ${description}
    Get${className}(store, params) {
      return _http.get(_api.system.costsController.${className?uncap_first}, { params }).then(payload => store.commit('GET_${className?upper_case}', payload))
    },
    Update${className}(store, params) {
      return _http.post(_api.system.costsController.${className?uncap_first}, params).then(payload => store.commit('UPDATE_${className?upper_case}', payload))
    },
    Del${className}(store, params) {
      return _http.delete(_api.system.costsController.${className?uncap_first}, { data: params }).then(payload => store.commit('DEL_${className?upper_case}', params))
    },
  }
})

// ${description}
${className?uncap_first}: '/${className?uncap_first}/{id}',
